%% Figure 4A
figure(1);
m=12;
load(strcat('Fig4\B00',num2str(m),'.mat'));
plot(datatest(26500:27400,1),datatest(26500:27400,2));

figure(2)
load(strcat('Fig4\B00',num2str(m),'pos.mat'));
plot(datatest(10000:30000,1),datatest(10000:30000,2));
hold off;
xlim([0,1.8]);

figure(3);
load(strcat('Fig4\B00',num2str(m),'.mat'));
plot(datatest(25500:26400,1),datatest(25500:26400,2));

figure(4);
load(strcat('Fig4\B00',num2str(m),'neg.mat'));
plot(datatest(10000:30000,1),datatest(10000:30000,2));
xlim([-1.8,0]);
%% Figure4B
figure(13)
load(strcat('Fig4\J00',num2str(710),'.mat'));
plot((3600:83600)./2000,datatest(3600:83600,1)./0.0024,'color',[0 0.4470 0.7410],'LineWidth',1);hold on; %0.0024 is the junction area times bias resistance
plot((3600:83600)./2000,datatest(3600:83600,2)./(0.0024*4),'LineWidth',1);%Divider changed from 2 to 4
hold off;
xlim([1.8 3.8]);ylim([-800 800])

figure(14)
load(strcat('Fig4\J00',num2str(711),'.mat'));
plot((3600:83600)./2000,datatest(3600:83600,1)./0.0024,'color',[0 0.4470 0.7410],'LineWidth',1);hold on; %0.0024 is the junction area times bias resistance
plot((3600:83600)./2000,datatest(3600:83600,2)./(0.0024*4),'LineWidth',1);%Divider changed from 2 to 4
hold off;
xlim([1.8 3.8]);ylim([-800 800])

%% Figure4B inset
figure(11)
load(strcat('Fig4\J00',num2str(711),'.mat'));
plot(datatest(4800:7800,1)./0.0024,datatest(4800:7800,2).*5) 
hold on
load(strcat('Fig4\J00',num2str(710),'.mat'));
plot(datatest(4800:7800,1)./0.0024,datatest(4800:7800,2).*5)
xlim([-600 600])
hold off

%% Figure4C
figure(101)
load(strcat('Fig4\J00',num2str(700),'.mat'));
plot((3600:8000)./2000,datatest(3600:8000,1)./0.0024,'color',[0 0.4470 0.7410],'LineWidth',1);hold on; %0.0024 is the junction area times bias resistance
plot((3600:8000)./2000,datatest(3600:8000,2)./(0.0024*4),'LineWidth',1);%Divider changed from 2 to 4
hold off;
xlim([1.8 3.8]);ylim([-800 800])

figure(102)
load(strcat('Fig4\J00',num2str(701),'.mat'));
plot((3600:8000)./2000,datatest(3600:8000,1)./0.0024,'color',[0 0.4470 0.7410],'LineWidth',1);hold on; %0.0024 is the junction area times bias resistance
plot((3600:8000)./2000,datatest(3600:8000,2)./(0.0024*4),'LineWidth',1);%Divider changed from 2 to 4
hold off;
xlim([1.8 3.8]);ylim([-800 800])

%% Figure4C inset
figure(113)
load(strcat('Fig4\J00',num2str(701),'.mat'));
plot(datatest(4800:7800,1)./0.0024,datatest(4800:7800,2).*5)
hold on
load(strcat('Fig4\J00',num2str(700),'.mat'));
plot(datatest(4800:7800,1)./0.0024,datatest(4800:7800,2).*5)
xlim([-600 600])
hold off

%% Figure4D
figure(11)
load(strcat('Fig4\J00',num2str(700),'.mat'));
plot((3600:83600)./2000,datatest(3600:83600,1)./0.0024,'color',[0 0.4470 0.7410],'LineWidth',1);hold on; %0.0024 is the junction area times bias resistance
plot((3600:83600)./2000,datatest(3600:83600,2)./(0.0024*4),'LineWidth',1);%Divider changed from 2 to 4
hold off;
xlim([1.8 41.8]);ylim([-800 800])

figure(12)
load(strcat('Fig4\J00',num2str(701),'.mat'));
plot((3600:83600)./2000,datatest(3600:83600,1)./0.0024,'color',[0 0.4470 0.7410],'LineWidth',1);hold on; %0.0024 is the junction area times bias resistance
plot((3600:83600)./2000,datatest(3600:83600,2)./(0.0024*4),'LineWidth',1);%Divider changed from 2 to 4
hold off;
xlim([1.8 41.8]);ylim([-800 800])

figure(13)
load(strcat('Fig4\J00',num2str(710),'.mat'));
plot((3600:83600)./2000,datatest(3600:83600,1)./0.0024,'color',[0 0.4470 0.7410],'LineWidth',1);hold on; %0.0024 is the junction area times bias resistance
plot((3600:83600)./2000,datatest(3600:83600,2)./(0.0024*4),'LineWidth',1);%Divider changed from 2 to 4
hold off;
xlim([1.8 41.8]);ylim([-800 800])

figure(14)
load(strcat('Fig4\J00',num2str(711),'.mat'));
plot((3600:83600)./2000,datatest(3600:83600,1)./0.0024,'color',[0 0.4470 0.7410],'LineWidth',1);hold on; %0.0024 is the junction area times bias resistance
plot((3600:83600)./2000,datatest(3600:83600,2)./(0.0024*4),'LineWidth',1);%Divider changed from 2 to 4
hold off;
xlim([1.8 41.8]);ylim([-800 800])

%% Figure4E positive side
% i = 10,32,42,54 correspond to the temperature values in the histogram
for i = 10
    
%step = 50*(i-10);
T = i;

load(strcat('Fig4\B00',num2str(T),'Icpos.mat'));

load(strcat('Fig4\B00',num2str(T),'Icposh.mat'));

figure(233)
Ic1 = histogram(Ic5Kpos./0.0025,[300:3:600]); hold on;
Ic2 = histogram(Ic5Kposh./0.0025,[300:3:600]);
hold off

end

xlim([300 600]);
ylim([0 900]);
hold off

%% Figure4E negative side
% i = 10,32,42,54 correspond to the temperature values in the histogram
for i = 10
    
T = i;

load(strcat('Fig4\B00',num2str(T),'Icneg.mat'));

load(strcat('Fig4\B00',num2str(T),'Icnegh.mat'));

figure(233)
Ic1 = histogram(Ic5Kneg./0.0025,[-600:3:-300]); hold on;
Ic2 = histogram(Ic5Knegh./0.0025,[-600:3:-300]);
hold off

end

xlim([-600 -300]);
ylim([0,900]);
hold off

%% Figure4F
twst = [43.7,44.5,40,43.5,41,40.5,39.5,30,34.8];
delta1 = [97,5.6,65,13,114,2,41,4,12];
err1 = [5.1,4.8,11.8,5.7,5.4,3.0,20.1,5.2,21.4];

delta2 = [104,3,4,21,143,14,64,6,21];
err2 = [5.3,5.1,16,6.6,23.9,3.5,17.2,4.8,14.5];

figure(941)
h1=errorbar(twst,delta1,err1,'o','DisplayName','|J_{c+}^{Full}-J_{c-}^{Half}|');set(h1, 'MarkerFaceColor', get(h1,'Color'));hold on; h2=errorbar(twst, delta2,err2,'o','DisplayName','|J_{c-}^{Full}-J_{c+}^{Half}|');
set(h2, 'MarkerFaceColor', get(h2,'Color'));hold off;
yticks([0:100:300]);
xticks([25:5:45]);
xlim([25 45]);
ylim([0,300])
legend

%% Figure4G
twst = [43.7,44.5,40,43.5,41,40.5,39.5,30,34.8];
deltaFull = [0.35,0.04,0,0.09,0.3,0.07,0.01,0,0.01];
errFull = [0.02,0.09,0.02,0.03,0.05,0.02,0.04,0,0.02];

deltaHalf = [0.37,0.03,0.07,0.07,0.24,0.01,0.04,0,0];
errHalf = [0.02,0.17,0.02,0.03,0.01,0.02,0.04,0,0.02];

figure(941)
h1=errorbar(twst,deltaFull,errFull,'ob','DisplayName','Full');set(h1, 'MarkerFaceColor', get(h1,'Color'));hold on;
h2=errorbar(twst,deltaHalf,errHalf,'or','DisplayName','Half');set(h2, 'MarkerFaceColor', get(h2,'Color'));hold off;

legend;hold off
xticks([25:5:45]);
xlim([25 45]);ylim([0 0.6]);